package adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.TextureView
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.example.hospitalmanagementapp.PeopleInformationModel
import com.example.hospitalmanagementapp.R
import java.util.zip.Inflater

class PeopleInformationAdapter(context: Context): RecyclerView.Adapter<PeopleInformationAdapter.PeopleInformationHolder>() {
    private  val context:Context=context
   lateinit var dataList: MutableList<PeopleInformationModel>




    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PeopleInformationHolder {
       return PeopleInformationHolder(  LayoutInflater.from(context).inflate(R.layout.people_information_item,parent,false))
    }

    override fun onBindViewHolder(holder: PeopleInformationHolder, position: Int) {
     holder.data.text= dataList[position].data
     holder.information.text=dataList[position].information
    }

    override fun getItemCount(): Int {
       return if (dataList.size==null) 0 else dataList.size
    }
    inner class PeopleInformationHolder(itemView: View):RecyclerView.ViewHolder(itemView){
    var data:TextView=itemView.findViewById(R.id.data_people)
    var information:TextView=itemView.findViewById(R.id.information_people)
    }
}
